package com.ldzl.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Objects;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ldzl.dto.AddPurchaseOrderDTO;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 采购订单表
 * @TableName ck_purchase_order
 */
@TableName(value ="ck_purchase_order")
@Data
public class CkPurchaseOrder implements Serializable {
    /**
     * 采购订单ID
     */
    @TableId(type = IdType.AUTO)
    private Long po_id;

    /**
     * 采购订单编号
     */
    private String po_code;

    /**
     * 采购订单名称
     */
    private String po_name;

    /**
     * 供应商ID
     */
    private Long supplier_id;

    /**
     * 供应商名称
     */
    private String supplier_name;

    /**
     * 批次编号
     */
    private String batch_code;

    /**
     * 采购日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date purchase_date;

    /**
     * 期望交货日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date expected_delivery_date;

    /**
     * 货币
     */
    private String currency;

    /**
     * 付款条款
     */
    private String payment_terms;

    /**
     * 订单状态 （待提交，已提交，采购中，到货，待上架，已上架）
     */
    private String status;

    /**
     * 订单总金额
     */
    private BigDecimal total_amount;

    /**
     * 采购类型
     */
    private String purchase_type;

    /**
     * 备注
     */
    private String remark;

    /**
     * 创建人
     */
    private String create_by;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date create_time;

    /**
     * 更新人
     */
    private String update_by;

    /**
     * 更新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date update_time;

    /**
     * 删除标志（0代表存在 1代表删除）
     */
    private String is_delete;

    /**
     * 可入库的商品数量
     */
    @TableField(exist = false)
    private int arrived_line_cnt;


    @TableField(exist = false)
    private static final long serialVersionUID = 1L;


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        CkPurchaseOrder that = (CkPurchaseOrder) o;
        return po_id.equals(that.po_id) && po_code.equals(that.po_code) && po_name.equals(that.po_name) && supplier_id.equals(that.supplier_id) && supplier_name.equals(that.supplier_name) && batch_code.equals(that.batch_code) && purchase_date.equals(that.purchase_date) && expected_delivery_date.equals(that.expected_delivery_date) && currency.equals(that.currency) && payment_terms.equals(that.payment_terms) && status.equals(that.status) && total_amount.equals(that.total_amount) && purchase_type.equals(that.purchase_type) && remark.equals(that.remark) && create_by.equals(that.create_by) && create_time.equals(that.create_time) && update_by.equals(that.update_by) && update_time.equals(that.update_time) && is_delete.equals(that.is_delete);
    }

    @Override
    public int hashCode() {
        return Objects.hash(po_id, po_code, po_name, supplier_id, supplier_name, batch_code, purchase_date, expected_delivery_date, currency, payment_terms, status, total_amount, purchase_type, remark, create_by, create_time, update_by, update_time, is_delete);
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", po_id=").append(po_id);
        sb.append(", po_code=").append(po_code);
        sb.append(", po_name=").append(po_name);
        sb.append(", supplier_id=").append(supplier_id);
        sb.append(", supplier_name=").append(supplier_name);
        sb.append(", batch_code=").append(batch_code);
        sb.append(", purchase_date=").append(purchase_date);
        sb.append(", expected_delivery_date=").append(expected_delivery_date);
        sb.append(", currency=").append(currency);
        sb.append(", payment_terms=").append(payment_terms);
        sb.append(", status=").append(status);
        sb.append(", total_amount=").append(total_amount);
        sb.append(", purchase_type=").append(purchase_type);
        sb.append(", remark=").append(remark);
        sb.append(", create_by=").append(create_by);
        sb.append(", create_time=").append(create_time);
        sb.append(", update_by=").append(update_by);
        sb.append(", update_time=").append(update_time);
        sb.append(", is_delete=").append(is_delete);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}